#include "DefFile.h"

using namespace std;

int main (int args, char* argv){
	const char* file_name ="LFR.txt";
	boost::dynamic_bitset<>* lfsr_z= GetLFSFfromFile(file_name);
	
	double B=1.0/pow(2,10);

	cout<<setprecision(5)<< "B is equal to "<<B<<endl;
	
	double A=0.01;
	const char* Quantile_text ="Quantile.txt";
	double ta = CalculateQuantile(A,Quantile_text);
	double tb = CalculateQuantile(B,Quantile_text);
	
	double C, N;

	ComputeCandN ( ta, tb, 0.25, 0.5, C, N );
	cout<<"C is "<<C<<"  N is "<<N;

	map<boost::dynamic_bitset<>*,int >  L1_map ;
	map<boost::dynamic_bitset<>*,int >  L2_map ;

	LFSRpolL1 = boost::dynamic_bitset<> ((string)"00000000101");//10100000000
	LFSRpolL2 = boost::dynamic_bitset<> ((string)"000011011");
	LFSRpolL3 = boost::dynamic_bitset<> ((string) "0000001001");

	for (int i=0;i<LFSRpolL1.size();++i)
		cout<<LFSRpolL1[i];cout<<endl;

	CreateLFSRdump(&LFSRpolL1,(int)N, &L1_map,lfsr_z);
	CreateLFSRdump(&LFSRpolL2,(int)N, &L2_map,lfsr_z);
	
	//Filter_map(&L1_map,C);
	//Filter_map(&L2_map,C);

	MapToFile(&L1_map,"DumpInitState_L1map.txt");
	//MapToFile(&L1_map,"DumpInitState_L2map.txt");

	delete lfsr_z;

	return EXIT_SUCCESS;
}

